//
// Created by Administrator on 2024/11/1.
//

#ifndef AI_PACS_JSONRESPONSE_H
#define AI_PACS_JSONRESPONSE_H


#include <nlohmann/json.hpp>
#include <string>
#include <CivetServer.h>

using json = nlohmann::json;
class JsonResponse {
public:

    JsonResponse(const json& data,const std::string& message = "success", int statusCode = 200)
            : msg(message), data(data),code(statusCode) {}
    void success(struct mg_connection *conn) const ;
    void error(struct mg_connection *conn) const ;
private:
    std::string msg;
    nlohmann::json data;
    int code;
};

#endif //AI_PACS_JSONRESPONSE_H
